<template>
  <h1>消息提示组件</h1>
  <el-button @click="f('success')">成功消息</el-button>
  <el-button @click="f('warning')">警告消息</el-button>
  <el-button @click="f('error')">错误消息</el-button>
  <el-button @click="f('info')">普通消息</el-button>
  <el-button @click="f('close')">可关闭消息</el-button>
</template>

<script setup>
  import {ElMessage} from "element-plus";

  const f = (type)=>{
    switch (type) {
      case 'success':ElMessage.success('这是一条成功消息');break;
      case 'warning':ElMessage.warning('这是一条警告消息');break;
      case 'error':ElMessage.error('这是一条错误消息');break;
      case 'info':ElMessage('这是一条普通消息');break;
      case 'close':ElMessage.info(
          {message:'这是一条可关闭消息',showClose:true}
      );
    }
  };
</script>

<style scoped>

</style>